// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   SUtils.java

package app;

import javax.microedition.lcdui.Graphics;

public class SUtils
{

    public SUtils()
    {
    }

    public static void drawColorDeg(Graphics g, int colorStart, int colorEnd, int x, int y, int width, int height, boolean isVertical)
    {
        int rgbColorStart[] = new int[3];
        int rgbColorEnd[] = new int[3];
        getRGB(colorStart, rgbColorStart);
        getRGB(colorEnd, rgbColorEnd);
        int rgb[] = new int[3];
        if(isVertical)
        {
            for(int i = 0; i < height - 1; i++)
            {
                for(int j = 0; j < 3; j++)
                    rgb[j] = ((rgbColorStart[j] - rgbColorEnd[j]) * i) / height + rgbColorEnd[j];

                g.setColor(rgb[0], rgb[1], rgb[2]);
                int newY = (y + height) - i - 1;
                g.drawLine(x, newY, x + width, newY);
            }

            g.setColor(colorStart);
            g.drawLine(x, y, x + width, y);
        } else
        {
            for(int i = 0; i < width - 1; i++)
            {
                for(int j = 0; j < 3; j++)
                    rgb[j] = Math.abs(((rgbColorStart[j] - rgbColorEnd[j]) * i) / width + rgbColorEnd[j]);

                g.setColor(rgb[0], rgb[1], rgb[2]);
                int newX = (x + width) - i - 1;
                g.drawLine(newX, y, newX, y + height);
            }

            g.setColor(colorStart);
            g.drawLine(x, y, x, y + height);
        }
    }

    private static void getRGB(int color, int rgb[])
    {
        rgb[0] = color >> 16;
        rgb[1] = (color & 0xff00) >> 8;
        rgb[2] = color & 0xff;
    }
}
